<template>
    <div class="login pc">
        <a-row align="align-items" class="login-box">
            <a-col :xs="24" :sm="24" :md="24">
                <div class="login-right">
                    <div class="login-right__left">
                        <img class="login-left__img" :src="logo" alt="banner"/>
                        <div
                            style="font-size: 20px;font-weight: 600;font-family: PingFang SC;color:#A26028;margin-top: 10px ">
                            商家端管理后台
                        </div>
                    </div>
                    <a-tabs :active-key="activeKey" class="login-right__form">
                        <a-tab-pane key="1" title="">
                            <AccountLogin/>
                        </a-tab-pane>
                        <a-tab-pane key="2" title="">
                            <PhoneLogin/>
                        </a-tab-pane>
                    </a-tabs>
<!--                    <div class="login-right__oauth">-->
<!--                        <a-divider orientation="center">或</a-divider>-->
<!--                        <div class="list">-->
<!--                            <a-space direction="vertical" fill class="w-full">-->
<!--                                <a-button class="btn"  size="large" long @click="changLogin">-->
<!--                                    <template #icon>-->
<!--                                        <icon-mobile />-->
<!--                                    </template>-->
<!--                                    {{name}}-->
<!--                                </a-button>-->
<!--                            </a-space>-->
<!--                        </div>-->
<!--                    </div>-->
                </div>
            </a-col>
        </a-row>
<!--        <div v-if="isDesktop" class="footer">-->
<!--            <div class="beian">-->
<!--                <div class="below text">{{-->
<!--                        appStore.getCopyright()-->
<!--                    }}{{ appStore.getForRecord() ? ` · ${appStore.getForRecord()}` : '' }}-->
<!--                </div>-->
<!--            </div>-->
<!--        </div>-->
<!--        <GiThemeBtn class="theme-btn"/>-->
        <Background/>
    </div>
    <div class="login h5">
        <a-row align="stretch" class="login-box">
            <a-col :xs="24" :sm="24" :md="24">
                <div class="login-right">
                    <div class="login-right__left">
                        <img class="login-left__img" :src="logo" alt="banner"/>
                        <div
                            style="font-size: 20px;font-weight: 600;font-family: PingFang SC;color:#A26028;margin-top: 10px ">
                            {{ title }}
                        </div>
                        <div
                            style="font-size: 20px;font-weight: 600;font-family: PingFang SC;color:#A26028;margin-top: 10px ">
                            商家端管理后台
                        </div>
                    </div>
                    <AccountLogin/>
                </div>
            </a-col>
        </a-row>
    </div>
</template>

<script setup lang="ts">
import Background from './components/background/index.vue'
import AccountLogin from './components/account/index.vue'
import PhoneLogin from './components/phone/index.vue'
import {useAppStore} from '@/stores'
import {useDevice} from '@/hooks'

defineOptions({name: 'Login'})
const {isDesktop} = useDevice()
const appStore = useAppStore()
const title = computed(() => appStore.getTitle())
const logo = computed(() => appStore.getLogo())
const activeKey = ref('1')
const name = ref('手機號碼登陸')
// 切换登录模式
const changLogin = () => {
    activeKey.value = activeKey.value === '1' ? '2' : '1'
    if(activeKey.value === '1'){
        name.value = '手機號碼登陸'
    }else{
        name.value = '使用賬號密碼登陸'
    }
}
</script>

<style lang="scss" scoped>
@media screen and (max-width: 570px) {
    .pc {
        display: none !important;
        background-color: white !important;
    }

    .login {
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: start;
        align-items: center;
        background-color: var(--color-bg-5);
        color: #121314;

        &-logo {
            width: 100%;
            height: 104px;
            font-weight: 700;
            font-size: 20px;
            line-height: 32px;
            display: flex;
            padding: 0 20px;
            align-items: center;
            justify-content: start;
            background-size: 100% 100%;
            box-sizing: border-box;

            img {
                width: 34px;
                height: 34px;
                margin-right: 8px;
            }
        }

        &-box {
            width: 100%;
            display: flex;
            z-index: 999;
        }
    }

    .login-right {
        width: 100%;
        height: 100%;
        display: flex;
        flex-direction: column;
        padding-top: 10px;
        padding-left: 30px;
        padding-right: 30px;
        border-radius: 16px;
        box-sizing: border-box;

        &__left {
            height: 168px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            overflow: hidden;
            margin-bottom: 5px;
            //background: linear-gradient(60deg, rgb(var(--primary-6)), rgb(var(--primary-3)));

            &__img {
                width: 83px;
                height: 83px;
                margin: 0 auto;
                transform: translateX(-50%) translateY(-50%);
                transition: all 0.3s;
                object-fit: cover;
            }
        }

        &__title {
            color: var(--color-text-1);
            font-weight: 500;
            font-size: 20px;
            line-height: 32px;
            margin-bottom: 20px;
        }

        &__form {
            :deep(.arco-tabs-nav-tab) {
                display: flex;
                justify-content: start;
                align-items: center;
            }

            :deep(.arco-tabs-tab) {
                color: var(--color-text-2);
                margin: 0 20px 0 0;
            }

            :deep(.arco-tabs-tab-title) {
                font-size: 16px;
                font-weight: 500;
                line-height: 22px;
            }

            :deep(.arco-tabs-content) {
                margin-top: -40px;
            }

            :deep(.arco-tabs-tab-active),
            :deep(.arco-tabs-tab-title:hover) {
                color: rgb(var(--arcoblue-6));
            }

            :deep(.arco-tabs-nav::before) {
                display: none;
            }

            :deep(.arco-tabs-tab-title:before) {
                display: none;
            }
        }

        &__oauth {
            width: 100%;
            position: fixed;
            bottom: 0;
            left: 0;
            padding-bottom: 20px;

            // margin-top: auto;
            // margin-bottom: 20px;
            :deep(.arco-divider-text) {
                color: var(--color-text-4);
                font-size: 12px;
                font-weight: 400;
                line-height: 20px;
            }

            .list {
                align-items: center;
                display: flex;
                justify-content: center;
                width: 100%;

                .item {
                    margin-right: 15px;
                }

                .mode {
                    color: var(--color-text-2);
                    font-size: 12px;
                    font-weight: 400;
                    line-height: 20px;
                    padding: 6px 10px;
                    align-items: center;
                    border: 1px solid var(--color-border-3);
                    border-radius: 32px;
                    box-sizing: border-box;
                    display: flex;
                    height: 32px;
                    justify-content: center;
                    cursor: pointer;

                    .icon {
                        width: 21px;
                        height: 20px;
                    }
                }

                .mode svg {
                    font-size: 16px;
                    margin-right: 10px;
                }

                .mode:hover,
                .mode svg:hover {
                    background: rgba(var(--primary-6), 0.05);
                    border: 1px solid rgb(var(--primary-3));
                    color: rgb(var(--arcoblue-6));
                }
            }
        }
    }

    .theme-btn {
        position: fixed;
        top: 20px;
        right: 30px;
        z-index: 9999;
    }

    .footer {
        align-items: center;
        box-sizing: border-box;
        position: absolute;
        bottom: 10px;
        z-index: 999;

        .beian {
            .text {
                color: #FFFFFF;
                font-size: 12px;
                font-weight: 400;
                letter-spacing: 0.2px;
                line-height: 20px;
                text-align: center;
            }

            .below {
                align-items: center;
                display: flex;
            }
        }
    }
}

@media screen and (min-width: 571px) {
    .h5 {
        display: none !important;
    }

    .login {
        height: 100%;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        background-color: var(--color-bg-5);

        &-logo {
            position: fixed;
            top: 20px;
            left: 30px;
            z-index: 9999;
            color: var(--color-text-1);
            font-weight: 500;
            font-size: 20px;
            line-height: 32px;
            margin-bottom: 20px;
            display: flex;
            justify-content: center;
            align-items: center;

            img {
                width: 34px;
                height: 34px;
                margin-right: 8px;
            }
        }

        &-box {
            width: 50%;
            max-width: 464px;
            height: 706px;
            display: flex;
            margin-top: 48px;
            margin-bottom: 48px;
            round-radius: 16px;
            z-index: 999;
            box-shadow: 0 2px 4px 2px rgba(0, 0, 0, 0.08);
        }
    }


    .login-right {
        width: 100%;
        height: 100%;
        background: var(--color-bg-1);
        display: flex;
        flex-direction: column;
        padding-top: 10px;
        padding-left: 30px;
        padding-right: 30px;
        box-sizing: border-box;

        &__left {
            height: 168px;
            display: flex;
            flex-direction: column;
            justify-content: center;
            align-items: center;
            overflow: hidden;
            margin-bottom: 5px;
            //background: linear-gradient(60deg, rgb(var(--primary-6)), rgb(var(--primary-3)));

            &__img {
                width: 83px;
                height: 83px;
                margin: 0 auto;
                transform: translateX(-50%) translateY(-50%);
                transition: all 0.3s;
                object-fit: cover;
            }
        }

        &__title {
            color: var(--color-text-1);
            font-weight: 500;
            font-size: 20px;
            line-height: 32px;
            margin-bottom: 20px;
        }

        &__form {
            :deep(.arco-tabs-nav-tab) {
                display: flex;
                justify-content: center;
                align-items: center;
            }

            :deep(.arco-tabs-tab) {
                color: var(--color-text-2);
            }

            :deep(.arco-tabs-tab-title) {
                font-size: 16px;
                font-weight: 500;
                line-height: 22px;
            }

            :deep(.arco-tabs-content) {
                margin-top: -40px;
            }

            :deep(.arco-tabs-tab-active),
            :deep(.arco-tabs-tab-title:hover) {
                color: rgb(var(--arcoblue-6));
            }

            :deep(.arco-tabs-nav::before) {
                display: none;
            }

            :deep(.arco-tabs-tab-title:before) {
                display: none;
            }
        }

        &__oauth {
            margin-top: auto;
            margin-bottom: 20px;

            :deep(.arco-divider-text) {
                color: var(--color-text-4);
                font-size: 12px;
                font-weight: 400;
                line-height: 20px;
            }

            .list {
                align-items: center;
                display: flex;
                justify-content: center;
                width: 100%;

                .item {
                    margin-right: 15px;
                }

                .mode {
                    color: var(--color-text-2);
                    font-size: 12px;
                    font-weight: 400;
                    line-height: 20px;
                    padding: 6px 10px;
                    align-items: center;
                    border: 1px solid var(--color-border-3);
                    border-radius: 32px;
                    box-sizing: border-box;
                    display: flex;
                    height: 32px;
                    justify-content: center;
                    cursor: pointer;

                    .icon {
                        width: 21px;
                        height: 20px;
                    }
                }

                .mode svg {
                    font-size: 16px;
                    margin-right: 10px;
                }

                .mode:hover,
                .mode svg:hover {
                    background: rgba(var(--primary-6), 0.05);
                    border: 1px solid rgb(var(--primary-3));
                    color: rgb(var(--arcoblue-6));
                }
            }
        }
    }

    .theme-btn {
        position: fixed;
        top: 20px;
        right: 30px;
        z-index: 9999;
    }

    .footer {
        align-items: center;
        box-sizing: border-box;
        position: absolute;
        bottom: 10px;
        z-index: 999;

        .beian {
            .text {
                font-size: 12px;
                font-weight: 400;
                color: #FFFFFF;
                letter-spacing: 0.2px;
                line-height: 20px;
                text-align: center;
            }

            .below {
                align-items: center;
                display: flex;
            }
        }
    }
}
</style>
